<?php

/**
 * DtCustomer form.
 *
 * @package    DUYTAN
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class DtCustomerForm extends BaseDtCustomerForm
{
  public function configure()
  {
	$action = sfContext::getInstance()->getActionName();
	$this->setWidgets(array(
		'phone_number'			=>		new sfWidgetFormInput(),
		'name'					=>		new sfWidgetFormInput(),
		'email'					=>		new sfWidgetFormInput(),
	));
	$this->widgetSchema->setLabels(array(
		'phone_number'			=>		'Số điện thoại',
		'name'					=>		'Tên',
		'email'					=>		'Email',
	));
	if ($action == 'edit')
		$this->setValidators(array(
			'phone_number'		=> 		new sfValidatorString(
				array('required'	=> true),
				array('required'	=> 'Số điện thoại là bắt buộc')
			),
			'name'				=>		new sfValidatorString(array('required' => false)),
			'email'				=>		new sfValidatorString(array('required' => false))
		));
	$this->widgetSchema->setNameFormat('customer[%s]');
  }
}
